package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.*;

import controller.MenuCTRL;

public class Mainframe extends JFrame{

	private static Mainframe instance;
	private JPanel mainpanel;
	private JPanel menupanel;
	private JButton accountLink;
	private JLabel text;
	
	public static Mainframe getInstance(){
		if(instance == null){
			instance = new Mainframe();
		}
		return instance;
	}
	
	private Mainframe(){
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(new Dimension(600,600));
		setLayout(null);
		setTitle("Kasboek Vera & Pepijn");
		
		menupanel = new JPanel();
		menupanel.setVisible(true);
		menupanel.setLayout(null);
		menupanel.setBounds(0,0,150,600);
		menupanel.setBackground(Color.blue);
		add(menupanel);
		
		mainpanel = new JPanel();
		mainpanel.setVisible(true);
		mainpanel.setLayout(null);
		mainpanel.setBounds(150,0,450,600);
		mainpanel.setBackground(Color.white);
		add(mainpanel);
		
		//Add components to menu panel
		
		text = new JLabel("Welkom");
		text.setVisible(true);
		text.setBounds(50,50,100,30);
		text.setFont(new Font("Verdana", Font.PLAIN, 20));
		mainpanel.add(text);
		
		
		//Done
		
		accountLink = new JButton("Accountbeheer");
		accountLink.setVisible(true);
		accountLink.setBounds(15,50,120,20);
		accountLink.setFont(new Font("Verdana", Font.PLAIN, 15));
		accountLink.setFocusPainted(false);
		accountLink.setMargin(new Insets(0, 0, 0, 0));
		accountLink.setContentAreaFilled(false);
		accountLink.setBorderPainted(false);
		accountLink.setOpaque(false);
		accountLink.addActionListener(new MenuCTRL());
		accountLink.setActionCommand("account");
		menupanel.add(accountLink);
		
	}

	public JPanel getMainpanel() {
		return mainpanel;
	}

	public void setMainpanel(JPanel mainpanel) {
		this.mainpanel = mainpanel;
	}
}
